package com.zc.app.shiro.realm;

import com.zc.app.shiro.peer.UserPeer;
import org.apache.shiro.authc.*;
import org.apache.shiro.realm.Realm;

/**
 * Created by zc on 2016/7/18.
 */
public class MyRealm7 implements Realm {
    @Override
    public String getName() {
        return "c";
    }

    @Override
    public boolean supports(AuthenticationToken token) {
        return token instanceof UsernamePasswordToken;
    }

    @Override
    public AuthenticationInfo getAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        UserPeer userPeer = new UserPeer("zhang", "123");

        return new SimpleAuthenticationInfo(
                userPeer,
                "123",
                getName()
        );
    }
}
